﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace EHR.Elements
{
    public partial class MapNavigater : UserControl
    {
        public event EventHandler<NavigateEventArgs> Navigating;

        public MapNavigater()
        {
            InitializeComponent();
        }

        private void RaiseNavigating(MapNavigateMode mode)
        {
            if(Navigating != null)
            {
                Navigating(this, new NavigateEventArgs(mode));
            }

        }

        private void toRight_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            RaiseNavigating(MapNavigateMode.ToRight);
        }

        private void toLeft_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            RaiseNavigating(MapNavigateMode.ToLeft);
        }

        private void toTop_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            RaiseNavigating(MapNavigateMode.ToTop);
        }

        private void toBottom_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            RaiseNavigating(MapNavigateMode.ToBottom);
        }

        private void reset_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            RaiseNavigating(MapNavigateMode.Reset);
        }

        private void reset_MouseEnter(object sender, MouseEventArgs e)
        {
            reset.Stroke = new SolidColorBrush(Colors.Black);
        }

        private void reset_MouseLeave(object sender, MouseEventArgs e)
        {
            reset.Stroke = new SolidColorBrush(Colors.Gray);
        }
    }

    public enum MapNavigateMode
    {
        Reset,
        ToLeft,
        ToRight,
        ToTop,
        ToBottom
    }

    public class NavigateEventArgs : EventArgs
    {
        public MapNavigateMode Mode { get; set; }

        public NavigateEventArgs(MapNavigateMode mode)
        {
            Mode = mode;
        }
    }
}
